Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherit much of geojson parser from GMT #8

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

vtnate
Copy link
Contributor

@vtnate vtnate commented Jan 14, 2025

urbanopt/geojson-modelica-translator#694 added most of the geojson parsing functionality from this repo into the GMT. Now we depend on the GMT, inherit from that class, and extend with geopandas only in this repo.

Also updated ruff, which then helped me clean up type hints. We can use the modern style because we require at least Python 3.10.

@vtnate vtnate added the enhancement New feature or request label Jan 14, 2025
@vtnate vtnate requested a review from nllong January 14, 2025 21:28
@vtnate vtnate self-assigned this Jan 14, 2025
pyproject.toml Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
@@ -1,7 +1,7 @@
import unittest
from pathlib import Path

from urbanopt_des.urbanopt_geojson import URBANoptGeoJSON
from urbanopt_des.urbanopt_geojson import DESGeoJSON
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the uo-des geojson parsing class, to not conflict with the one from the GMT. Should it be different?Happy to change the name to something else if that makes more sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move all the methods out of DESGeoJSON... looks like the only one remaining is create_aggregated_representation. Can we move that over to GMT's GeoJSON?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change this filename too, as well as the class name?

Copy link
Member

@nllong nllong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one action to consider.

@@ -1,7 +1,7 @@
import unittest
from pathlib import Path

from urbanopt_des.urbanopt_geojson import URBANoptGeoJSON
from urbanopt_des.urbanopt_geojson import DESGeoJSON
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move all the methods out of DESGeoJSON... looks like the only one remaining is create_aggregated_representation. Can we move that over to GMT's GeoJSON?

@vtnate
Copy link
Contributor Author

vtnate commented Jan 17, 2025

Looks good, one action to consider.

Yes, we can easily move that to the GMT. I didn't do so because that method depends on geopandas, and therefore gdal (which has about a zillion dependencies itself). I was trying to keep that out of the GMT. Please opine :)

@nllong
Copy link
Member

nllong commented Jan 17, 2025

oh, then we shouldn't move. However, we should probably recreate without geopandas. Shouldn't be hard, but let's write tests first. Does GMT rely on pandas at all?

@vtnate
Copy link
Contributor Author

vtnate commented Jan 17, 2025

oh, then we shouldn't move. However, we should probably recreate without geopandas. Shouldn't be hard, but let's write tests first. Does GMT rely on pandas at all?

Yes, regular pandas is used in the GMT. I've idly thought of replacing that with Polars, or of trying to refactor to just use stdlib, but not very seriously (also, Teams just blew up on me, forcing a reinstall, not just a restart, lol).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants